class Solution
{
public:
    vector<int> diStringMatch(string s)
    {
        vector<int> vi;
        int len = s.size();
        int n = 0, m = len, i = 0;
        while (n != m)
        {
            if (s[i] == 'D')
            {
                vi.push_back(m);
                m--;
            }
            else
            {
                vi.push_back(n);
                n++;
            }
            i++;
        }
        vi.push_back(n);
        return vi;
    }
};